<template>
  <div class="container">
    <!-- 内容部分 -->
    <div class="operate">
      <slot></slot>
      <div style="margin-right: auto"></div>
      <slot name="op"></slot>
    </div>
    <div class="content" :style="{ maxHeight: item.h * 40 - 80 + 'px' }">
      <ListTable :options="tableOptions" :records="tableRecords" />
    </div>
  </div>
</template>

<script setup lang="ts">
  /**
   * @description 公共组件 -- 表格
   */
  import { ref } from "vue";
  import { ListTable } from "@visactor/vue-vtable";
  defineProps(["item"]);

  const tableOptions = ref({
    columns: [
      { field: "0", title: "name" },
      { field: "1", title: "age" },
      { field: "2", title: "gender" },
      { field: "3", title: "hobby" },
    ],
  });
  const tableRecords = ref(new Array(1000).fill(["John", 18, "male", "🏀"]));
</script>

<style scoped lang="scss">
  .container {
    user-select: none;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 0px 10px 10px;
    font-size: 14px;
    color: #999;
    .content {
      flex: 1;
      display: flex;
      flex-direction: column;
      margin-top: 10px;
      overflow: hidden;
    }
  }

  .content-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
  }
  .content-item-main {
    display: flex;
    flex-direction: column;
  }
  .operate {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
  }
</style>
